/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * IFMunicipios.java
 *
 * Created on 06/02/2012, 08:58:27
 */
package gui.frames.internos;

import controle.gui.frames.internos.ControleBoletimTratamento;
import controle.gui.superclasses.InternalFrame;
import controle.gui.utils.ComboBoxUtils;
import gui.componentes.JTextFieldCodigo;
import gui.componentes.MascarasJTextField;
import javax.swing.JFormattedTextField;

/**
 * Frame interno para gerenciamento de Localidades e Croquis
 *
 * @author Maycon Fernando Silva Brito
 * @author mayconfsbrito@gmail.com
 */
public class IFBoletimTratamento extends InternalFrame {

    /*
     * Variáveis da classe
     */
    private ControleBoletimTratamento controle = new ControleBoletimTratamento(this);
    public SelectionListener listener;

    /*
     * Creates new form IFMunicipios
     */
    public IFBoletimTratamento() {
        initComponents();
        this.listener = new SelectionListener(this.tabela);
        this.inicializa();
    }

    @Override
    protected void inicializa() {
        controle.inicializa();
    }

    @Override
    protected void limparGUI() {
        controle.limparGUI();
    }

    @Override
    protected void tabelaPreencheGUI() {
        controle.tabelaPreencheGUI();
    }

    /**
     * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this method is always regenerated by the
     * Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        groupAtv = new javax.swing.ButtonGroup();
        groupCategoria = new javax.swing.ButtonGroup();
        panelInformacoes = new javax.swing.JPanel();
        labelId = new javax.swing.JLabel();
        labelCoordenador = new javax.swing.JLabel();
        labelLocalidade = new javax.swing.JLabel();
        textId = new javax.swing.JTextField();
        comboLocalidade = new javax.swing.JComboBox();
        textCodigoLocalidade = new JTextFieldCodigo(4, false);
        labelMunicípio = new javax.swing.JLabel();
        labelAgente = new javax.swing.JLabel();
        textCodigoAgente = new JTextFieldCodigo(3, true);
        comboAgente = new javax.swing.JComboBox();
        labelData = new javax.swing.JLabel();
        textData = new javax.swing.JFormattedTextField(new MascarasJTextField().inserirMascara("##/##/####"));
        ((JFormattedTextField)textData).setFocusLostBehavior(JFormattedTextField.COMMIT);
        panelVisitas = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        tabelaVisitas = new javax.swing.JTable();
        buttonRemover = new javax.swing.JButton();
        buttonInserir = new javax.swing.JButton();
        textTurma = new JTextFieldCodigo(4, true);
        labelTurma = new javax.swing.JLabel();
        textNomeMunicipio = new javax.swing.JTextField();
        textCodigoMunicipio = new JTextFieldCodigo(7, true);
        comboCordRegional = new gui.componentes.JComboBoxEstado();
        jPanel1 = new javax.swing.JPanel();
        radioCategoriaSede = new javax.swing.JRadioButton();
        radioCategoriaOutros = new javax.swing.JRadioButton();
        jPanel2 = new javax.swing.JPanel();
        radioAtvTF = new javax.swing.JRadioButton();
        radioAtvPE = new javax.swing.JRadioButton();
        radioAtvPVE = new javax.swing.JRadioButton();
        radioAtvDF = new javax.swing.JRadioButton();
        labelDistrito = new javax.swing.JLabel();
        textCodigoGRS = new JTextFieldCodigo(2, true);
        labelSemana = new javax.swing.JLabel();
        textSemana = new JTextFieldCodigo(2, false, false);
        labelSemana1 = new javax.swing.JLabel();
        textSemanaAno = new JTextFieldCodigo(4, false, false);
        labelNumeroAtividade = new javax.swing.JLabel();
        textNumeroAtividade = new JTextFieldCodigo(2, false, false);
        textNumeroAtividadeAno = new JTextFieldCodigo(4, false, false);
        labelSemana2 = new javax.swing.JLabel();
        panelLocalidades = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        tabela = new javax.swing.JTable();
        panelOpcoes = new javax.swing.JPanel();
        buttonCancelar = new javax.swing.JButton();
        buttonCadastro = new javax.swing.JButton();
        buttonAlterar = new javax.swing.JButton();
        buttonDesativar = new javax.swing.JButton();
        buttonLimpar = new javax.swing.JButton();
        buttonAtivar = new javax.swing.JButton();
        buttonImprimir = new javax.swing.JButton();
        panelBusca = new javax.swing.JPanel();
        labelBuscaData = new javax.swing.JLabel();
        buttonBuscar = new javax.swing.JButton();
        buttonLimparBusca = new javax.swing.JButton();
        textBuscaData = new javax.swing.JFormattedTextField(new MascarasJTextField().inserirMascara("##/##/####"));
        ((JFormattedTextField)textBuscaData).setFocusLostBehavior(JFormattedTextField.COMMIT);
        labelBuscaIdAgente = new javax.swing.JLabel();
        textBuscaCodigoAgente = new JTextFieldCodigo(3, true);
        labelBuscaMunicipio = new javax.swing.JLabel();
        textBuscaCodigoMunicipio = new JTextFieldCodigo(7, true);
        textBuscaNomeMunicipio = new javax.swing.JTextField();
        labelBuscaLocalidade = new javax.swing.JLabel();
        textBuscaCodigoLocalidade = new JTextFieldCodigo(4, false);
        comboBuscaLocalidade = new javax.swing.JComboBox();
        comboBuscaAgente = new javax.swing.JComboBox();

        setClosable(true);
        setIconifiable(true);
        setMaximizable(true);
        setTitle("Boletins de Tratamento");
        setMaximumSize(null);
        setMinimumSize(new java.awt.Dimension(870, 700));
        setPreferredSize(new java.awt.Dimension(870, 700));

        panelInformacoes.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Informações do Boletim", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION));

        labelId.setText("Id Boletim:");

        labelCoordenador.setText("C. Regional:");

        labelLocalidade.setText("Localidade:>");

        textId.setEnabled(false);
        textId.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                textIdActionPerformed(evt);
            }
        });

        comboLocalidade.setModel(ComboBoxUtils.inicializaComboBoxEntidades("Selecione...", "Localidade", "nome"));
        comboLocalidade.setEnabled(false);
        comboLocalidade.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                comboLocalidadeActionPerformed(evt);
            }
        });

        textCodigoLocalidade.setEnabled(false);
        textCodigoLocalidade.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                textCodigoLocalidadeActionPerformed(evt);
            }
        });

        labelMunicípio.setText("Município:>");

        labelAgente.setText("Agente:>");

        textCodigoAgente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                textCodigoAgenteActionPerformed(evt);
            }
        });

        comboAgente.setModel(ComboBoxUtils.inicializaComboBoxEntidades("Selecione...", "Agente WHERE idAgente!=1 AND ativo=TRUE", "nome"));
        comboAgente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                comboAgenteActionPerformed(evt);
            }
        });

        labelData.setText("Data:");

        ((JFormattedTextField)textData).setHorizontalAlignment(textData.LEFT);

        panelVisitas.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Visitas de Tratamento", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION));

        tabelaVisitas.setFont(new java.awt.Font("DejaVu Sans", 0, 11)); // NOI18N
        tabelaVisitas.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Id", "Hora", "Quadra", "Logradouro", "Imovel", "Complemento", "Pendência", "Q. Con.", "U. Bolet."
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Integer.class, java.lang.String.class, java.lang.Integer.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false, false, false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        tabelaVisitas.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tabelaVisitasMouseClicked(evt);
            }
        });
        jScrollPane2.setViewportView(tabelaVisitas);

        buttonRemover.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/Remover.png"))); // NOI18N
        buttonRemover.setText("Remover");
        buttonRemover.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonRemoverActionPerformed(evt);
            }
        });

        buttonInserir.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/Adicionar.png"))); // NOI18N
        buttonInserir.setText("Inserir");
        buttonInserir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonInserirActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelVisitasLayout = new javax.swing.GroupLayout(panelVisitas);
        panelVisitas.setLayout(panelVisitasLayout);
        panelVisitasLayout.setHorizontalGroup(
            panelVisitasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelVisitasLayout.createSequentialGroup()
                .addComponent(jScrollPane2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panelVisitasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(buttonRemover, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(buttonInserir, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(0, 0, 0))
        );
        panelVisitasLayout.setVerticalGroup(
            panelVisitasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelVisitasLayout.createSequentialGroup()
                .addGroup(panelVisitasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(panelVisitasLayout.createSequentialGroup()
                        .addComponent(buttonInserir)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(buttonRemover))
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 87, Short.MAX_VALUE))
                .addGap(0, 0, 0))
        );

        textTurma.setEnabled(false);
        textTurma.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                textTurmaActionPerformed(evt);
            }
        });

        labelTurma.setText("Turma:");

        textNomeMunicipio.setEnabled(false);

        textCodigoMunicipio.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                textCodigoMunicipioActionPerformed(evt);
            }
        });

        comboCordRegional.setEnabled(false);

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Categoria:"));

        groupCategoria.add(radioCategoriaSede);
        radioCategoriaSede.setSelected(true);
        radioCategoriaSede.setText("Sede");

        groupCategoria.add(radioCategoriaOutros);
        radioCategoriaOutros.setText("Outros");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(radioCategoriaSede)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(radioCategoriaOutros)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(radioCategoriaSede)
                    .addComponent(radioCategoriaOutros))
                .addGap(0, 0, Short.MAX_VALUE))
        );

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Tipo Atividade:"));

        groupAtv.add(radioAtvTF);
        radioAtvTF.setSelected(true);
        radioAtvTF.setText("T.F.");

        groupAtv.add(radioAtvPE);
        radioAtvPE.setText("P.E.");

        groupAtv.add(radioAtvPVE);
        radioAtvPVE.setText("P.V.E.");

        groupAtv.add(radioAtvDF);
        radioAtvDF.setText("D.F.");
        radioAtvDF.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                radioAtvDFActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(radioAtvTF)
                .addGap(18, 18, 18)
                .addComponent(radioAtvPE)
                .addGap(18, 18, 18)
                .addComponent(radioAtvPVE)
                .addGap(0, 0, 0)
                .addComponent(radioAtvDF)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(radioAtvTF)
                    .addComponent(radioAtvPE)
                    .addComponent(radioAtvPVE)
                    .addComponent(radioAtvDF))
                .addGap(0, 0, Short.MAX_VALUE))
        );

        labelDistrito.setText("GRS:");

        labelSemana.setText("Sem. Epid.:");

        textSemana.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                textSemanaActionPerformed(evt);
            }
        });

        labelSemana1.setText("/");

        textSemanaAno.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                textSemanaAnoActionPerformed(evt);
            }
        });

        labelNumeroAtividade.setText("Nº Atividade:");

        textNumeroAtividade.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                textNumeroAtividadeActionPerformed(evt);
            }
        });

        textNumeroAtividadeAno.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                textNumeroAtividadeAnoActionPerformed(evt);
            }
        });

        labelSemana2.setText("/");

        javax.swing.GroupLayout panelInformacoesLayout = new javax.swing.GroupLayout(panelInformacoes);
        panelInformacoes.setLayout(panelInformacoesLayout);
        panelInformacoesLayout.setHorizontalGroup(
            panelInformacoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelInformacoesLayout.createSequentialGroup()
                .addGroup(panelInformacoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(labelMunicípio, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(labelAgente, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(panelInformacoesLayout.createSequentialGroup()
                        .addComponent(labelId)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
                .addGroup(panelInformacoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(panelInformacoesLayout.createSequentialGroup()
                        .addComponent(textId, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(labelData)
                        .addGap(0, 0, 0)
                        .addComponent(textData, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(labelDistrito)
                        .addGap(0, 0, 0)
                        .addComponent(textCodigoGRS, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(panelInformacoesLayout.createSequentialGroup()
                        .addGroup(panelInformacoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(textCodigoMunicipio, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(textCodigoAgente, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(panelInformacoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(textNomeMunicipio, javax.swing.GroupLayout.DEFAULT_SIZE, 221, Short.MAX_VALUE)
                            .addComponent(comboAgente, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                .addGap(9, 9, 9)
                .addGroup(panelInformacoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(panelInformacoesLayout.createSequentialGroup()
                        .addComponent(labelSemana)
                        .addGap(0, 0, 0)
                        .addComponent(textSemana, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(labelSemana1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(textSemanaAno, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(labelNumeroAtividade)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(textNumeroAtividade, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(labelSemana2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(textNumeroAtividadeAno, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(panelInformacoesLayout.createSequentialGroup()
                        .addGroup(panelInformacoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(panelInformacoesLayout.createSequentialGroup()
                                .addComponent(labelCoordenador)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(comboCordRegional, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(panelInformacoesLayout.createSequentialGroup()
                                .addComponent(labelLocalidade)
                                .addGap(0, 0, 0)
                                .addComponent(textCodigoLocalidade, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(panelInformacoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(comboLocalidade, 0, 285, Short.MAX_VALUE)
                            .addGroup(panelInformacoesLayout.createSequentialGroup()
                                .addComponent(labelTurma)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(textTurma, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                .addGap(4, 4, 4))
            .addComponent(panelVisitas, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(panelInformacoesLayout.createSequentialGroup()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, Short.MAX_VALUE))
        );
        panelInformacoesLayout.setVerticalGroup(
            panelInformacoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelInformacoesLayout.createSequentialGroup()
                .addGroup(panelInformacoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(panelInformacoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(textId, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(labelId)
                        .addComponent(textData, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(labelData)
                        .addComponent(labelDistrito)
                        .addComponent(textCodigoGRS, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(panelInformacoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(labelNumeroAtividade)
                        .addComponent(textNumeroAtividadeAno, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(labelSemana2)
                        .addComponent(textNumeroAtividade, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(panelInformacoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(labelSemana)
                        .addComponent(textSemana, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(textSemanaAno, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(labelSemana1)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panelInformacoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelMunicípio)
                    .addComponent(textCodigoMunicipio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(textNomeMunicipio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(labelLocalidade)
                    .addComponent(textCodigoLocalidade, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(comboLocalidade, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panelInformacoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(panelInformacoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(textTurma, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(labelTurma))
                    .addGroup(panelInformacoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(labelAgente)
                        .addComponent(textCodigoAgente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(comboAgente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(labelCoordenador)
                        .addComponent(comboCordRegional, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(0, 0, 0)
                .addGroup(panelInformacoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(0, 0, 0)
                .addComponent(panelVisitas, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        panelLocalidades.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Boletins Cadastrados", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION));

        tabela.setAutoCreateRowSorter(true);
        tabela.setFont(new java.awt.Font("DejaVu Sans", 0, 11)); // NOI18N
        tabela.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Id", "Data", "Municipio", "Localidade", "Agente"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Integer.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane1.setViewportView(tabela);

        javax.swing.GroupLayout panelLocalidadesLayout = new javax.swing.GroupLayout(panelLocalidades);
        panelLocalidades.setLayout(panelLocalidadesLayout);
        panelLocalidadesLayout.setHorizontalGroup(
            panelLocalidadesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1)
        );
        panelLocalidadesLayout.setVerticalGroup(
            panelLocalidadesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelLocalidadesLayout.createSequentialGroup()
                .addGap(0, 0, 0)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 93, Short.MAX_VALUE))
        );

        panelOpcoes.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Opções", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION));

        buttonCancelar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/Cancelar.png"))); // NOI18N
        buttonCancelar.setText("Cancelar");
        buttonCancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonCancelarActionPerformed(evt);
            }
        });

        buttonCadastro.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/Confirma.png"))); // NOI18N
        buttonCadastro.setText("Cadastrar");
        buttonCadastro.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonCadastroActionPerformed(evt);
            }
        });

        buttonAlterar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/Alterar.png"))); // NOI18N
        buttonAlterar.setText("Alterar");
        buttonAlterar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonAlterarActionPerformed(evt);
            }
        });

        buttonDesativar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/Desativar.png"))); // NOI18N
        buttonDesativar.setText("Desativar");
        buttonDesativar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonDesativarActionPerformed(evt);
            }
        });

        buttonLimpar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/Novo.png"))); // NOI18N
        buttonLimpar.setText("Novo/Limpar");
        buttonLimpar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonLimparActionPerformed(evt);
            }
        });

        buttonAtivar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/Ativar.png"))); // NOI18N
        buttonAtivar.setText("Ativar");
        buttonAtivar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonAtivarActionPerformed(evt);
            }
        });

        buttonImprimir.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/Imprimir.png"))); // NOI18N
        buttonImprimir.setText("Imprimir");
        buttonImprimir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonImprimirActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelOpcoesLayout = new javax.swing.GroupLayout(panelOpcoes);
        panelOpcoes.setLayout(panelOpcoesLayout);
        panelOpcoesLayout.setHorizontalGroup(
            panelOpcoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelOpcoesLayout.createSequentialGroup()
                .addComponent(buttonCadastro)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(buttonAlterar)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(buttonImprimir)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(buttonDesativar)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(buttonAtivar)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(buttonLimpar)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(buttonCancelar)
                .addContainerGap(18, Short.MAX_VALUE))
        );
        panelOpcoesLayout.setVerticalGroup(
            panelOpcoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(buttonCadastro)
            .addGroup(panelOpcoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(buttonDesativar)
                .addComponent(buttonAlterar)
                .addComponent(buttonImprimir))
            .addGroup(panelOpcoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(buttonLimpar)
                .addComponent(buttonCancelar)
                .addComponent(buttonAtivar))
        );

        panelBusca.setBorder(javax.swing.BorderFactory.createTitledBorder("Busca"));

        labelBuscaData.setText("Data:");

        buttonBuscar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/Buscar.png"))); // NOI18N
        buttonBuscar.setText("Buscar");
        buttonBuscar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonBuscarActionPerformed(evt);
            }
        });

        buttonLimparBusca.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/Limpar.png"))); // NOI18N
        buttonLimparBusca.setText("Limpar Busca");
        buttonLimparBusca.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonLimparBuscaActionPerformed(evt);
            }
        });

        ((JFormattedTextField)textBuscaData).setHorizontalAlignment(textBuscaData.LEFT);
        textBuscaData.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                textBuscaDataActionPerformed(evt);
            }
        });

        labelBuscaIdAgente.setText("Agente:>");

        textBuscaCodigoAgente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                textBuscaCodigoAgenteActionPerformed(evt);
            }
        });

        labelBuscaMunicipio.setText("Município:>");

        textBuscaCodigoMunicipio.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                textBuscaCodigoMunicipioActionPerformed(evt);
            }
        });

        textBuscaNomeMunicipio.setEnabled(false);
        textBuscaNomeMunicipio.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                textBuscaNomeMunicipioActionPerformed(evt);
            }
        });

        labelBuscaLocalidade.setText("Localidade:>");

        textBuscaCodigoLocalidade.setEnabled(false);
        textBuscaCodigoLocalidade.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                textBuscaCodigoLocalidadeActionPerformed(evt);
            }
        });

        comboBuscaLocalidade.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Selecione..." }));
        comboBuscaLocalidade.setEnabled(false);
        comboBuscaLocalidade.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                comboBuscaLocalidadeActionPerformed(evt);
            }
        });

        comboBuscaAgente.setModel(ComboBoxUtils.inicializaComboBoxEntidades("Selecione...", "Agente WHERE idAgente!=1", "nome"));
        comboBuscaAgente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                comboBuscaAgenteActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelBuscaLayout = new javax.swing.GroupLayout(panelBusca);
        panelBusca.setLayout(panelBuscaLayout);
        panelBuscaLayout.setHorizontalGroup(
            panelBuscaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelBuscaLayout.createSequentialGroup()
                .addComponent(buttonBuscar)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(buttonLimparBusca)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(panelBuscaLayout.createSequentialGroup()
                .addGroup(panelBuscaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(labelBuscaMunicipio)
                    .addComponent(labelBuscaData))
                .addGroup(panelBuscaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(panelBuscaLayout.createSequentialGroup()
                        .addComponent(textBuscaCodigoMunicipio, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(textBuscaNomeMunicipio, javax.swing.GroupLayout.DEFAULT_SIZE, 260, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(labelBuscaLocalidade)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(textBuscaCodigoLocalidade, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(comboBuscaLocalidade, 0, 213, Short.MAX_VALUE))
                    .addGroup(panelBuscaLayout.createSequentialGroup()
                        .addComponent(textBuscaData, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(labelBuscaIdAgente)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(textBuscaCodigoAgente, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(comboBuscaAgente, 0, 497, Short.MAX_VALUE)))
                .addGap(5, 5, 5))
        );
        panelBuscaLayout.setVerticalGroup(
            panelBuscaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelBuscaLayout.createSequentialGroup()
                .addGroup(panelBuscaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(textBuscaCodigoAgente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(labelBuscaIdAgente)
                    .addComponent(textBuscaData, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(labelBuscaData)
                    .addComponent(comboBuscaAgente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panelBuscaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelBuscaMunicipio)
                    .addComponent(textBuscaNomeMunicipio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(textBuscaCodigoMunicipio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(labelBuscaLocalidade)
                    .addComponent(textBuscaCodigoLocalidade, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(comboBuscaLocalidade, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(0, 0, 0)
                .addGroup(panelBuscaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(buttonBuscar)
                    .addComponent(buttonLimparBusca)))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(panelOpcoes, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(panelInformacoes, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(panelLocalidades, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(panelBusca, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(6, 6, 6))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(panelBusca, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, 0)
                .addComponent(panelLocalidades, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(0, 0, 0)
                .addComponent(panelInformacoes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, 0)
                .addComponent(panelOpcoes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void buttonCadastroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonCadastroActionPerformed
        controle.cadastrar();
    }//GEN-LAST:event_buttonCadastroActionPerformed

    private void buttonAlterarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonAlterarActionPerformed
        controle.alterar();
    }//GEN-LAST:event_buttonAlterarActionPerformed

    private void buttonDesativarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonDesativarActionPerformed
        controle.desativar();
    }//GEN-LAST:event_buttonDesativarActionPerformed

    private void buttonBuscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonBuscarActionPerformed
        controle.buscar();
    }//GEN-LAST:event_buttonBuscarActionPerformed

    private void buttonLimparBuscaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonLimparBuscaActionPerformed
        controle.limparBusca();
    }//GEN-LAST:event_buttonLimparBuscaActionPerformed

    private void textBuscaCodigoAgenteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textBuscaCodigoAgenteActionPerformed
        controle.eventoTextCodigoAgentes(textBuscaCodigoAgente, comboBuscaAgente, true);
    }//GEN-LAST:event_textBuscaCodigoAgenteActionPerformed

    private void textCodigoAgenteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textCodigoAgenteActionPerformed
        controle.eventoTextCodigoAgentes(this.textCodigoAgente, this.comboAgente, false);
    }//GEN-LAST:event_textCodigoAgenteActionPerformed

    private void buttonRemoverActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonRemoverActionPerformed
        controle.removerVisita();
    }//GEN-LAST:event_buttonRemoverActionPerformed

    private void buttonInserirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonInserirActionPerformed
        controle.novaVisita();
    }//GEN-LAST:event_buttonInserirActionPerformed

    private void textTurmaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textTurmaActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_textTurmaActionPerformed

    private void tabelaVisitasMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tabelaVisitasMouseClicked
        controle.consultaTabelaVisitas(evt);
    }//GEN-LAST:event_tabelaVisitasMouseClicked

    private void comboLocalidadeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboLocalidadeActionPerformed
        controle.comboLocalidade(this.comboLocalidade, this.textCodigoLocalidade, this.textCodigoMunicipio);
    }//GEN-LAST:event_comboLocalidadeActionPerformed

    private void textCodigoMunicipioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textCodigoMunicipioActionPerformed
        controle.eventoTextCodigoMunicipio(this.textCodigoLocalidade, this.comboLocalidade, 
                this.textCodigoMunicipio, this.textNomeMunicipio, this.textTurma, this.comboCordRegional);
    }//GEN-LAST:event_textCodigoMunicipioActionPerformed

    private void textCodigoLocalidadeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textCodigoLocalidadeActionPerformed
        controle.textCodigoLocalidade(this.textCodigoLocalidade, this.comboLocalidade, this.textCodigoMunicipio);
    }//GEN-LAST:event_textCodigoLocalidadeActionPerformed

    private void comboAgenteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboAgenteActionPerformed
        controle.eventoComboAgentes(this.comboAgente, this.textCodigoAgente);
    }//GEN-LAST:event_comboAgenteActionPerformed

    private void buttonAtivarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonAtivarActionPerformed
        controle.ativar();
    }//GEN-LAST:event_buttonAtivarActionPerformed

    private void textBuscaCodigoMunicipioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textBuscaCodigoMunicipioActionPerformed
        controle.eventoTextCodigoMunicipio(this.textBuscaCodigoLocalidade, this.comboBuscaLocalidade, this.textBuscaCodigoMunicipio, this.textBuscaNomeMunicipio);
    }//GEN-LAST:event_textBuscaCodigoMunicipioActionPerformed

    private void textBuscaCodigoLocalidadeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textBuscaCodigoLocalidadeActionPerformed
        controle.eventoTextCodigoLocalidade(this.textBuscaCodigoLocalidade, this.comboBuscaLocalidade, this.textBuscaCodigoMunicipio, null);
    }//GEN-LAST:event_textBuscaCodigoLocalidadeActionPerformed

    private void comboBuscaLocalidadeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboBuscaLocalidadeActionPerformed
        controle.eventoComboLocalidade(this.textBuscaCodigoLocalidade, this.comboBuscaLocalidade, this.textBuscaCodigoMunicipio, null, null, null);
    }//GEN-LAST:event_comboBuscaLocalidadeActionPerformed

    private void comboBuscaAgenteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboBuscaAgenteActionPerformed
        controle.eventoComboAgentes(this.comboBuscaAgente, textBuscaCodigoAgente);
    }//GEN-LAST:event_comboBuscaAgenteActionPerformed

    private void textBuscaNomeMunicipioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textBuscaNomeMunicipioActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_textBuscaNomeMunicipioActionPerformed

    private void textBuscaDataActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textBuscaDataActionPerformed
        controle.buscar();
    }//GEN-LAST:event_textBuscaDataActionPerformed

    private void buttonImprimirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonImprimirActionPerformed
        controle.imprimir();
    }//GEN-LAST:event_buttonImprimirActionPerformed

    private void radioAtvDFActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_radioAtvDFActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_radioAtvDFActionPerformed

    private void textIdActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textIdActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_textIdActionPerformed

    private void textSemanaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textSemanaActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_textSemanaActionPerformed

    private void textSemanaAnoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textSemanaAnoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_textSemanaAnoActionPerformed

    private void textNumeroAtividadeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textNumeroAtividadeActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_textNumeroAtividadeActionPerformed

    private void textNumeroAtividadeAnoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textNumeroAtividadeAnoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_textNumeroAtividadeAnoActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    public javax.swing.JButton buttonAlterar;
    public javax.swing.JButton buttonAtivar;
    public javax.swing.JButton buttonBuscar;
    public javax.swing.JButton buttonCadastro;
    public javax.swing.JButton buttonCancelar;
    public javax.swing.JButton buttonDesativar;
    public javax.swing.JButton buttonImprimir;
    public javax.swing.JButton buttonInserir;
    public javax.swing.JButton buttonLimpar;
    public javax.swing.JButton buttonLimparBusca;
    public javax.swing.JButton buttonRemover;
    public javax.swing.JComboBox comboAgente;
    public javax.swing.JComboBox comboBuscaAgente;
    public javax.swing.JComboBox comboBuscaLocalidade;
    public javax.swing.JComboBox comboCordRegional;
    public javax.swing.JComboBox comboLocalidade;
    public javax.swing.ButtonGroup groupAtv;
    private javax.swing.ButtonGroup groupCategoria;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JLabel labelAgente;
    private javax.swing.JLabel labelBuscaData;
    private javax.swing.JLabel labelBuscaIdAgente;
    private javax.swing.JLabel labelBuscaLocalidade;
    private javax.swing.JLabel labelBuscaMunicipio;
    private javax.swing.JLabel labelCoordenador;
    private javax.swing.JLabel labelData;
    private javax.swing.JLabel labelDistrito;
    private javax.swing.JLabel labelId;
    private javax.swing.JLabel labelLocalidade;
    private javax.swing.JLabel labelMunicípio;
    private javax.swing.JLabel labelNumeroAtividade;
    private javax.swing.JLabel labelSemana;
    private javax.swing.JLabel labelSemana1;
    private javax.swing.JLabel labelSemana2;
    private javax.swing.JLabel labelTurma;
    private javax.swing.JPanel panelBusca;
    private javax.swing.JPanel panelInformacoes;
    private javax.swing.JPanel panelLocalidades;
    private javax.swing.JPanel panelOpcoes;
    private javax.swing.JPanel panelVisitas;
    public javax.swing.JRadioButton radioAtvDF;
    public javax.swing.JRadioButton radioAtvPE;
    public javax.swing.JRadioButton radioAtvPVE;
    public javax.swing.JRadioButton radioAtvTF;
    public javax.swing.JRadioButton radioCategoriaOutros;
    public javax.swing.JRadioButton radioCategoriaSede;
    public javax.swing.JTable tabela;
    public javax.swing.JTable tabelaVisitas;
    public javax.swing.JTextField textBuscaCodigoAgente;
    public javax.swing.JTextField textBuscaCodigoLocalidade;
    public javax.swing.JTextField textBuscaCodigoMunicipio;
    public javax.swing.JTextField textBuscaData;
    public javax.swing.JTextField textBuscaNomeMunicipio;
    public javax.swing.JTextField textCodigoAgente;
    public javax.swing.JTextField textCodigoGRS;
    public javax.swing.JTextField textCodigoLocalidade;
    public javax.swing.JTextField textCodigoMunicipio;
    public javax.swing.JTextField textData;
    public javax.swing.JTextField textId;
    public javax.swing.JTextField textNomeMunicipio;
    public javax.swing.JTextField textNumeroAtividade;
    public javax.swing.JTextField textNumeroAtividadeAno;
    public javax.swing.JTextField textSemana;
    public javax.swing.JTextField textSemanaAno;
    public javax.swing.JTextField textTurma;
    // End of variables declaration//GEN-END:variables
}
